function setStorage(key,val){
    if( val instanceof Array || typeof val === "object" ){
        localStorage.setItem(key,JSON.stringify(val))
    }else{
        localStorage.setItem(key,val)
    }
}

function getStorage(key){
    let val = localStorage.getItem(key)
    var reg = /^[[{].*[}\]]$/;
    console.log(val);
    if(reg.test(val)){
        // val =  JSON.parse(val)
    }
    return val
}

export {setStorage,getStorage}